package com.financing.wap.service.impl;


import java.sql.SQLException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.financing.wap.dao.IFpShopProjectInformationDao;
import com.financing.wap.dto.FpShopProjectInformationDTO;
import com.financing.wap.service.IFpShopProjectInformationService;
import com.financing.wap.util.DTOdateSetUtil;
/**
 * fp_shop_project_information  
 * 产品资讯关联表 业务访问层实现类
 * @author huqiyun
 *
 */
 
@Repository("fpShopProjectInformationService")
public class FpShopProjectInformationServiceImpl implements IFpShopProjectInformationService{

	@Autowired
	private IFpShopProjectInformationDao fpShopProjectInformationDao;

	@Override
	public int insert(FpShopProjectInformationDTO fpShopProjectInformation) throws SQLException {
		DTOdateSetUtil.setCreateInfo(fpShopProjectInformation);
		DTOdateSetUtil.setUpdateInfo(fpShopProjectInformation);
//		fpShopProjectInformation.setDeleteTag(CommonStatus.DELETE_TAG_NORMAL);
		return fpShopProjectInformationDao.insert(fpShopProjectInformation);
	}

	@Override
	public void update(FpShopProjectInformationDTO fpShopProjectInformation) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(fpShopProjectInformation);
		fpShopProjectInformationDao.update(fpShopProjectInformation);
	}

	@Override
	public void updateForce(FpShopProjectInformationDTO fpShopProjectInformation) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(fpShopProjectInformation);
		fpShopProjectInformationDao.updateForce(fpShopProjectInformation);
	}

	@Override
	public void delete(Integer id) throws SQLException {
		fpShopProjectInformationDao.delete(id);
	}
	
	@Override
	public List<FpShopProjectInformationDTO> queryList(FpShopProjectInformationDTO fpShopProjectInformation) throws SQLException {
		return fpShopProjectInformationDao.queryList(fpShopProjectInformation);
	}

	@Override
	public int queryListCount(FpShopProjectInformationDTO fpShopProjectInformation) throws SQLException {
		return fpShopProjectInformationDao.queryListCount(fpShopProjectInformation);
	}

	@Override
	public FpShopProjectInformationDTO loadById(Integer id) throws SQLException {
		return fpShopProjectInformationDao.loadById(id);
	}
 	@Override
	public FpShopProjectInformationDTO queryListGetFirst(FpShopProjectInformationDTO fpShopProjectInformation)
			throws SQLException {
		 List<FpShopProjectInformationDTO> queryList = queryList(fpShopProjectInformation);
		 if(queryList==null||queryList.size()==0){
			 return new FpShopProjectInformationDTO();
		 }
		 return queryList.get(0);
	}
}
